<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<c-rt:if test="${!empty param.cqtId}">

<c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', param.cqtId)}"/>
${pu:criteriaForName('com.yaodian100.crm.cs.entity.MustInquire')}
${pu:criteriaAdd(
	pu:criteriaOr(
		pu:criteriaOr(
			pu:criteria('eq', 'commonQuestionType.id', cqt.parent.parent.id),
			pu:criteria('eq', 'commonQuestionType.id', cqt.parent.id)),
		pu:criteria('eq', 'commonQuestionType.id', cqt.id)
	)
	)}
<c-rt:set var="mis" value="${pu:criteriaResult(null)}"/>
<c-rt:forEach items="${mis}" var="mi">
<c-rt:set var="isExist" value="false"/>
<c-rt:forEach items="${pu:split(param.mustInquire, ',')}" var="p">

	<c-rt:if test="${mi.id==p}">
		<c-rt:set var="isExist" value="true"/>
	</c-rt:if>
</c-rt:forEach>
<input type="checkbox" name="mustInquirec" class="mustInquirec" value="${mi.id }" <c-rt:if test="${isExist=='true' }">checked="checked"</c-rt:if>/>${mi.description }<br/>

</c-rt:forEach>
<input type="hidden" id="mustInquire" name="mustInquire" value="${param.mustInquire }"/>
<script>
$(function(){
		$('.mustInquirec').each(function(){
			$(this).click(function(){
				$('#mustInquire').attr('value', '');
				var miValue="";
				$('.mustInquirec').each(function(){
					//alert($(this).attr('checked'));
					if($(this).attr('checked')==true){
						if(miValue!=''){
							miValue+=','+$(this).attr('value');
						}else{
							miValue+=$(this).attr('value');
						}
					}
					//alert(miValue);
				});
				$('#mustInquire').attr('value', miValue);
			});
		});
});
</script>

</c-rt:if>
<c-rt:if test="${empty param.cqtId}">
<input type="hidden" id="mustInquire" name="mustInquire" value=""/>
</c-rt:if>